package com.yan.arraylist;

import java.util.ArrayList;

public class Test1 {
    public static void main(String[] args) {
        ArrayList<String> name = new ArrayList<>();
        name.add("孙悟空");
        name.add("猪八戒");
        name.add("沙和尚");
        name.add("铁扇公主");
        System.out.println(name);
        System.out.println(name.get(3));
        System.out.println(name.size());
        name.remove("铁扇公主");
        System.out.println(name);
        name.remove(2);
        name.set(name.indexOf("猪八戒") , "猪悟能");
        System.out.println(name);
    }
}
